<script setup>
const props = defineProps({
  comment: {
    type: Array,
    required: true,
  },
})
const { comment } = toRefs(props)
</script>

<template>
  <div>
    <div class="text-xl font-extrabold">
      一共 {{ comment.length }} 条评价
    </div>
    <div v-for="item in comment" :key="item.id" class="comment">
      <div class="comment-avatar">
        <el-avatar class="comment_avatar" :src="item.avatar" />
      </div>
      <div class="content-wrap">
        <div class="comment-username font-bold">
          {{ item.username }}
        </div>
        <div class="comment-content text-sm">
          {{ item?.content }}
        </div>
        <div class="comment-time">
          <span> {{ item.createTime }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.comment {
  display: flex;
  margin: 10px 0px;
  .content-wrap {
    width: 100%;
    margin-left: 10px;
    .comment-username {
      margin-right: 5px;
      font: bold;
      color: #222222;
      cursor: pointer;
    }
    .comment-content {
      // color: #18191c;
      overflow: hidden;
      word-wrap: break-word;
      word-break: break-word;
      white-space: pre-wrap;
      line-height: 24px;
      vertical-align: baseline;
    }
    .comment-time {
      color: #9499a0;
      font-size: 13px;
    }
    .reply-wrap {
      padding: 10px 0 0 0;
      width: 100%;

      .reply-content {
        display: flex;
        padding: 10px 0;
      }
    }
  }
}
</style>
